<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>导航菜单</title>
</head>
<body>
<ul id="nav">
</ul>
<select id="slt">

</select>
<button id="btnAdd">添加</button>
<button id="btnRemove">移除</button>


</body>
<script src="../mock/items.js"></script>

<script>


     var  nav = document.getElementById('nav');
     nav=  renderUL(nav,items);

     for(var key in items){
         if(items[key].children){
            var innerUL= renderUL(null,items[key].children);
            nav.children[key].appendChild(innerUL);
         }
     }

    /*渲染UL*/
    function renderUL(nav,items){
        if(!nav){
            nav = document.createElement('ul');
        }
        nav.innerHTML="";
        for (var key in items){
            var listItem = document.createElement('li');
            listItem.innerText = items[key].title;
            nav.appendChild(listItem);
        }
        return nav
    }



 var listItem=   document.createElement('li');
 listItem.innerText ="";
// listItem.appendChild();


 var opt=   document.createElement('option');
 opt.text="" ;
 opt.value="";
</script>
</html>